﻿function ClientAddLawDocument()
{
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    Url=Portal.CMS.LawDocument.GetAddGroupNewUrl(belongSite).value;
    window.open(Url, '_blank');
    //RealJumpPageLawDocument();
}

function ClientSaveAddLawDocument()
{
    Alias = document.getElementById("txtAlias").value;
    Subject = document.getElementById("txtSubject").value;
    ShowInMenu=document.getElementById("chkShowInMenu").checked;
    belongSite=document.getElementById("txtbelongSite").value;
    RetValue = Portal.CMS.AddLawDocument.ServerSideAddLawDocument(belongSite, Alias, Subject, ShowInMenu).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    document.getElementById("txtAlias").value = "";
    document.getElementById("txtSubject").value="";
    document.getElementById("txtAlias").focus();
}

function ClientDeleteLawDocument(LawDocumentId)
{
    Msg=Portal.CMS.LawDocument.ServerSideCheckDeleteLawDocument().value;
    if(Msg.indexOf("ERROR")!=-1)
    {
        alert(Msg);
        return;
    }
    
    Msg=Portal.CMS.LawDocument.GetConfirmDeleteMsg().value;
    if(confirm(Msg)==false)return;
    RetValue = Portal.CMS.LawDocument.ServerSideDeleteLawDocument(LawDocumentId).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    RealJumpPageLawDocument();
}

function ShowClientUpdateUrlForm(LawDocumentId)
{
    Url=Portal.CMS.LawDocument.GetShowUpdateForm(LawDocumentId).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    window.open(Url, '_blank');
//    RealJumpPageLawDocument();
}



function ClientSaveUpdateLawDocument(LawDocumentId) {
    Alias = document.getElementById("txtAlias").value;
    Subject=document.getElementById("txtSubject").value;
    ShowInMenu=document.getElementById("chkShowInMenu").checked;
    RetValue = Portal.CMS.UpdateLawDocument.ServerSideUpdateLawDocument(LawDocumentId, Alias, Subject, ShowInMenu).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    window.close();
}


function ShowClientLawDocumentItemUrlForm(LawDocumentId)
{
    Url=Portal.CMS.LawDocument.GetShowLawDocumentItemsForm(LawDocumentId).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    window.open(Url, '_blank');
}

function ClientShowNewsItemForms(LawDocumentId)
{
    Url=Portal.CMS.LawDocument.GetShowNewsItemForm(LawDocumentId).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    window.open(Url, '_blank');
}



function JumPageLawDocument()
{
    document.getElementById("divProcessing").innerHTML=Portal.CMS.LawDocument.GetProcessingText().value;
    setTimeout("RealJumpPageLawDocument()",10);
}

function RealJumpPageLawDocument()
{
    PageIndex=0;
    if(document.getElementById("divSelectPageLawDocument")!=null)
    {   
        PageIndex=document.getElementById("divSelectPageLawDocument").selectedIndex;
    }
    Keyword=document.getElementById("txtKeyword").value;
    belongSite=document.getElementById("drpSelectSite").options[document.getElementById("drpSelectSite").selectedIndex].value;
    retValue=Portal.CMS.LawDocument.GetHtml(belongSite,Keyword,PageIndex).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        alert(retValue);
        return;
    }
    document.getElementById("divProcessing").innerHTML="";
    document.getElementById("divLawDocumentMain").innerHTML=retValue;
}

function ClientShowItems(LawDocumentId)
{
     Url=Portal.CMS.LawDocument.GetShowItemsForm(LawDocumentId).value;
     if(Url.indexOf("ERROR")!=-1)
     {
        alert(Url);
        return;
     }
     window.open(Url, "_blank"); 
}

function ClientSearch(LawDocumentId)
{
     document.getElementById("divProcessing").innerHTML=Portal.CMS.LawDocumentItems.GetProcessingText().value;
     setTimeout("RealClientSearch('"+LawDocumentId+"')",10);
}

function RealClientSearch(LawDocumentId)
{
     Code=document.getElementById("txtCode").value;
     Subject=document.getElementById("txtSubject").value;
     LawDocumentOfficeId=document.getElementById("drpSelectLawDocumentOffice").options[document.getElementById("drpSelectLawDocumentOffice").selectedIndex].value;
     LawDocumentTypeId=document.getElementById("drpSelectLawDocumentType").options[document.getElementById("drpSelectLawDocumentType").selectedIndex].value;
     LawDocumentSignerId=document.getElementById("drpSelectLawDocumentSigner").options[document.getElementById("drpSelectLawDocumentSigner").selectedIndex].value;
     Keyword=document.getElementById("txtKeyword").value;
     PageIndex=0;
     if(document.getElementById("txtPageIndex")!=null)
     {
        PageIndex=document.getElementById("txtPageIndex").value;
     }
     
     retValue=Portal.CMS.LawDocumentItems.Search(LawDocumentId,Code, Subject, LawDocumentSignerId, LawDocumentTypeId, LawDocumentOfficeId,Keyword,PageIndex).value;
     if(retValue.indexOf("ERROR")!=-1)
     {
        document.getElementById("divProcessing").innerHTML="";
        alert(retValue);
        return;
     }
     document.getElementById("divProcessing").innerHTML="";
     document.getElementById("divFormResult").innerHTML=retValue;
}



function ClientSearchOnly(LawDocumentId)
{
     document.getElementById("divProcessing").innerHTML=Portal.CMS.SearchLawDocumentItems.GetProcessingText().value;
     setTimeout("RealClientSearchOnly('"+LawDocumentId+"')",10);
}

function RealClientSearchOnly(LawDocumentId)
{
     Code=document.getElementById("txtCode").value;
     Subject=document.getElementById("txtSubject").value;
     Keyword=document.getElementById("txtKeyword").value;
     LawDocumentOfficeId=document.getElementById("drpSelectLawDocumentOffice").options[document.getElementById("drpSelectLawDocumentOffice").selectedIndex].value;
     LawDocumentTypeId=document.getElementById("drpSelectLawDocumentType").options[document.getElementById("drpSelectLawDocumentType").selectedIndex].value;
     LawDocumentSignerId=document.getElementById("drpSelectLawDocumentSigner").options[document.getElementById("drpSelectLawDocumentSigner").selectedIndex].value;
     PageIndex=0;
     if(document.getElementById("txtPageIndex")!=null)
     {
        PageIndex=document.getElementById("txtPageIndex").value;
     }
     
     retValue=Portal.CMS.SearchLawDocumentItems.Search(LawDocumentId,Code, Subject, LawDocumentSignerId, LawDocumentTypeId, LawDocumentOfficeId,Keyword,PageIndex).value;
     if(retValue.indexOf("ERROR")!=-1)
     {
        document.getElementById("divProcessing").innerHTML="";
        alert(retValue);
        return;
     }
     document.getElementById("divProcessing").innerHTML="";
     document.getElementById("divFormResult").innerHTML=retValue;
}





function ClientSearchAll()
{
     document.getElementById("divProcessing").innerHTML=Portal.CMS.SearchAllLawDocumentItems.GetProcessingText().value;
     setTimeout("RealClientSearchAll()",10);
}

function RealClientSearchAll()
{
     Code=document.getElementById("txtCode").value;
     Subject=document.getElementById("txtSubject").value;
     LawDocumentId=document.getElementById("drpSelectLawDocument").options[document.getElementById("drpSelectLawDocument").selectedIndex].value;
     LawDocumentOfficeId=document.getElementById("drpSelectLawDocumentOffice").options[document.getElementById("drpSelectLawDocumentOffice").selectedIndex].value;
     LawDocumentTypeId=document.getElementById("drpSelectLawDocumentType").options[document.getElementById("drpSelectLawDocumentType").selectedIndex].value;
     LawDocumentSignerId=document.getElementById("drpSelectLawDocumentSigner").options[document.getElementById("drpSelectLawDocumentSigner").selectedIndex].value;
     Keyword=document.getElementById("txtKeyword").value;
     PageIndex=0;
     if(document.getElementById("txtPageIndex")!=null)
     {
        PageIndex=document.getElementById("txtPageIndex").value;
     }
     
     retValue=Portal.CMS.SearchAllLawDocumentItems.Search(LawDocumentId,Code, Subject, LawDocumentSignerId, LawDocumentTypeId, LawDocumentOfficeId,Keyword,PageIndex).value;
     if(retValue.indexOf("ERROR")!=-1)
     {
        document.getElementById("divProcessing").innerHTML="";
        alert(retValue);
        return;
     }
     document.getElementById("divProcessing").innerHTML="";
     document.getElementById("divFormResult").innerHTML=retValue;
}



function ClientAddLawDocumentItem(LawDocumentId)
{
    Url=Portal.CMS.LawDocumentItems.GetAddLawDocumentItemUrl(LawDocumentId).value;
     if(Url.indexOf("ERROR")!=-1)
     {
        alert(Url);
        return;
     }
    window.open(Url, '_blank');
}


function AddLawDocumentItemFromList(LawDocumentId)
{
     Url=Portal.CMS.LawDocument.GetAddLawDocumentItemUrl(LawDocumentId).value;
     if(Url.indexOf("ERROR")!=-1)
     {
        alert(Url);
        return;
     }
    window.open(Url, '_blank');
}


function SaveAddLawDocumentItem(LawDocumentId)
{
     Code=document.getElementById("txtCode").value;
     Subject=document.getElementById("txtSubject").value;
     Keyword=document.getElementById("txtKeyword").value;
     Body=document.getElementById("txtBody").value;
     LawDocumentOfficeId=document.getElementById("drpSelectLawDocumentOffice").options[document.getElementById("drpSelectLawDocumentOffice").selectedIndex].value;
     LawDocumentTypeId=document.getElementById("drpSelectLawDocumentType").options[document.getElementById("drpSelectLawDocumentType").selectedIndex].value;
     LawDocumentSignerId=document.getElementById("drpSelectLawDocumentSigner").options[document.getElementById("drpSelectLawDocumentSigner").selectedIndex].value;
     ReleasedDate=document.getElementById("txtReleasedDate").value;
     EffectedDate=document.getElementById("txtEffectedDate").value;
     ExpiredDate = document.getElementById("txtExpiredDate").value;
     EntryDate = document.getElementById("txtEntryDate").value;

     LawDocumentItemId = Portal.CMS.AddLawDocumentItem.Save(LawDocumentId, Code, Subject, Keyword, Body, LawDocumentTypeId, LawDocumentOfficeId, LawDocumentSignerId, ReleasedDate, EffectedDate, ExpiredDate, EntryDate).value;
     if(LawDocumentItemId.indexOf("ERROR")!=-1)
     {
        alert(LawDocumentItemId);
        return;
     }
     UploadItemFromAddForm(LawDocumentItemId);
     document.getElementById("txtCode").value="";
     document.getElementById("txtSubject").value="";
     document.getElementById("txtKeyword").value="";
     document.getElementById("txtBody").value="";
     document.getElementById("drpSelectLawDocumentOffice").selectedIndex=0;
     document.getElementById("drpSelectLawDocumentType").selectedIndex=0;
     document.getElementById("drpSelectLawDocumentSigner").selectedIndex=0;
     document.getElementById("txtReleasedDate").value="";
     document.getElementById("txtEffectedDate").value="";
     document.getElementById("txtExpiredDate").value="";
     document.getElementById("txtCode").focus();
}


function UpdateItem(LawDocumentItemId)
{
     Url=Portal.CMS.LawDocumentItems.GetUpdateLawDocumentItemUrl(LawDocumentItemId).value;
     if(Url.indexOf("ERROR")!=-1)
     {
        alert(Url);
        return;
     }
    window.open(Url, '_blank');
}

function SaveUpdateLawDocumentItem(LawDocumentItemId)
{
     Code=document.getElementById("txtCode").value;
     Subject=document.getElementById("txtSubject").value;
     Keyword=document.getElementById("txtKeyword").value;
     Body=document.getElementById("txtBody").value;
     LawDocumentOfficeId=document.getElementById("drpSelectLawDocumentOffice").options[document.getElementById("drpSelectLawDocumentOffice").selectedIndex].value;
     LawDocumentTypeId=document.getElementById("drpSelectLawDocumentType").options[document.getElementById("drpSelectLawDocumentType").selectedIndex].value;
     LawDocumentSignerId=document.getElementById("drpSelectLawDocumentSigner").options[document.getElementById("drpSelectLawDocumentSigner").selectedIndex].value;
     ReleasedDate=document.getElementById("txtReleasedDate").value;
     EffectedDate=document.getElementById("txtEffectedDate").value;
     ExpiredDate = document.getElementById("txtExpiredDate").value;
     EntryDate = document.getElementById("txtEntryDate").value;
     retValue = Portal.CMS.UpdateLawDocumentItem.Save(LawDocumentItemId, Code, Subject, Keyword, Body, LawDocumentTypeId, LawDocumentOfficeId, LawDocumentSignerId, ReleasedDate, EffectedDate, ExpiredDate, EntryDate).value;
     if(retValue.indexOf("ERROR")!=-1)
     {
        alert(retValue);
        return;
     }
     alert(retValue);
     window.close();
}

function UploadItem(LawDocumentItemId)
{
     Url=Portal.CMS.LawDocumentItems.GetUpdateContentLawDocumentItemUrl(LawDocumentItemId).value;
     if(Url.indexOf("ERROR")!=-1)
     {
        alert(Url);
        return;
     }
     window.open(Url, '_blank'); 
}

function UploadItemFromAddForm(LawDocumentItemId)
{
     Url=Portal.CMS.AddLawDocumentItem.GetUpdateContentLawDocumentItemUrl(LawDocumentItemId).value;
     if(Url.indexOf("ERROR")!=-1)
     {
        alert(Url);
        return;
     }
     window.open(Url, '_blank'); 
}



function DownloadItem(LawDocumentItemId)
{
     Url=Portal.CMS.LawDocumentItems.ServerSideDownloadItem(LawDocumentItemId).value;
     if(Url.indexOf("ERROR")!=-1)
     {
        alert(Url);
        return;
     }
     window.open(Url,"_blank");
}

function DownloadItemOnly(LawDocumentItemId)
{
     Url=Portal.CMS.SearchLawDocumentItems.ServerSideDownloadItem(LawDocumentItemId).value;
     if(Url.indexOf("ERROR")!=-1)
     {
        alert(Url);
        return;
     }
     window.open(Url,"_blank");
 }

 function DownloadItemOnlyForShowList(LawDocumentItemId) {
     Url = Portal.CMS.ShowListDocumentItems.ServerSideDownloadItem(LawDocumentItemId).value;
     if (Url.indexOf("ERROR") != -1) {
         alert(Url);
         return;
     }
     window.open(Url, "_blank");
 }


function DownloadItemFromSearchAll(LawDocumentItemId)
{
     Url=Portal.CMS.SearchAllLawDocumentItems.ServerSideDownloadItem(LawDocumentItemId).value;
     if(Url.indexOf("ERROR")!=-1)
     {
        alert(Url);
        return;
     }
     window.open(Url,"_blank");
}

function ClientDeleteLawDocumentItem(LawDocumentId,LawDocumentItemId)
{
    Msg=Portal.CMS.LawDocumentItems.ServerSideCheckDeleteLawDocumentItem(LawDocumentItemId).value;
    if(Msg.indexOf("ERROR")!=-1)
    {
        alert(Msg);
        return;
    }
    
    Msg=Portal.CMS.LawDocumentItems.GetConfirmDeleteMsg().value;
    if(confirm(Msg)==false)return;
    RetValue = Portal.CMS.LawDocumentItems.ServerSideDeleteLawDocumentItem(LawDocumentItemId).value;
    if(RetValue.indexOf("ERROR")!=-1)
    {
        alert(RetValue);
        return;
    }
    alert(RetValue);
    ClientSearch(LawDocumentId);
}



function PermissionLawDocumentItem(LawDocumentItemId)
{
    Url=Portal.CMS.LawDocumentItems.GetShowFormSetPermissionLawDocumentItem(LawDocumentItemId).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    window.open(Url, '_blank');
}


function ClientPermissionLawDocument(LawDocumentId)
{
    Url=Portal.CMS.LawDocument.GetShowFormSetPermissionLawDocument(LawDocumentId).value;
    if(Url.indexOf("ERROR")!=-1)
    {
        alert(Url);
        return;
    }
    window.open(Url, '_blank');
}

function detectSigner()
{
    document.getElementById("divSigner").innerHTML=Portal.CMS.AddLawDocumentItem.GetProcessingText().value;
    setTimeout("RealDetectSigner()",10);
}



function RealDetectSigner()
{
    Keyword=document.getElementById("txtFilterSigner").value;
    retValue=Portal.CMS.AddLawDocumentItem.ServerDetectSigner(Keyword).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        document.getElementById("divSigner").innerHTML="";
        alert(retValue);
        return;
    }
    document.getElementById("divSigner").innerHTML=retValue;
}

function detectOffice()
{
    document.getElementById("divOffice").innerHTML=Portal.CMS.AddLawDocumentItem.GetProcessingText().value;
    setTimeout("RealDetectOffice()",10);
}


function RealDetectOffice()
{
    Keyword=document.getElementById("txtFilterOffice").value;
    retValue=Portal.CMS.AddLawDocumentItem.ServerDetectOffice(Keyword).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        document.getElementById("divOffice").innerHTML="";
        alert(retValue);
        return;
    }
    document.getElementById("divOffice").innerHTML=retValue;
}

function detectDocType()
{
   document.getElementById("divDocumentType").innerHTML=Portal.CMS.AddLawDocumentItem.GetProcessingText().value;
   setTimeout("RealDetectDocType()",10);
}




function RealDetectDocType()
{
    Keyword=document.getElementById("txtFilterDoctype").value;
    retValue=Portal.CMS.AddLawDocumentItem.ServerDetectDocumentType(Keyword).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        document.getElementById("divDocumentType").innerHTML="";
        alert(retValue);
        return;
    }
    document.getElementById("divDocumentType").innerHTML=retValue;
}


function detectUpdateSigner()
{
   document.getElementById("divSigner").innerHTML=Portal.CMS.UpdateLawDocumentItem.GetProcessingText().value;
   setTimeout("RealDetectUpdateSigner()",10);
}




function RealDetectUpdateSigner()
{
    Keyword=document.getElementById("txtFilterSigner").value;
    retValue=Portal.CMS.UpdateLawDocumentItem.ServerDetectSigner(Keyword).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        document.getElementById("divSigner").innerHTML="";
        alert(retValue);
        return;
    }
    document.getElementById("divSigner").innerHTML=retValue;
}


function detectUpdateOffice()
{
    document.getElementById("divOffice").innerHTML=Portal.CMS.UpdateLawDocumentItem.GetProcessingText().value;
    setTimeout("RealDetectUpdateOffice()",10);
}


function RealDetectUpdateOffice()
{
    Keyword=document.getElementById("txtFilterOffice").value;
    retValue=Portal.CMS.UpdateLawDocumentItem.ServerDetectOffice(Keyword).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        document.getElementById("divOffice").innerHTML="";
        alert(retValue);
        return;
    }
    document.getElementById("divOffice").innerHTML=retValue;
}



function detectUpdateDocType()
{
    document.getElementById("divDocumentType").innerHTML=Portal.CMS.UpdateLawDocumentItem.GetProcessingText().value;
    setTimeout("RealDetectUpdateDocType()",10);
}


function RealDetectUpdateDocType()
{
    Keyword=document.getElementById("txtFilterDoctype").value;
    retValue=Portal.CMS.UpdateLawDocumentItem.ServerDetectDocumentType(Keyword).value;
    if(retValue.indexOf("ERROR")!=-1)
    {
        document.getElementById("divDocumentType").innerHTML="";
        alert(retValue);
        return;
    }
    document.getElementById("divDocumentType").innerHTML=retValue;
}

function JumpPageLawDocumentItemForShowList(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPageIndex, JumpJavaScript) {
    document.getElementById("divProcessing").innerHTML = Portal.CMS.ShowListDocumentItems.GetProcessingText().value;
    setTimeout("RealJumpPageLawDocumentItemForShowList('"+TabModuleId+"','"+CurrentPageIndex+"')", 10);
}

function RealJumpPageLawDocumentItemForShowList(TabModuleId,CurrentPageIndex) {
    rValue = Portal.CMS.ShowListDocumentItems.Search(TabModuleId, CurrentPageIndex).value;
    if (rValue.indexOf("ERROR") != -1) {
        alert(rValue);
        return;
    }
    document.getElementById("divFormResult").innerHTML = rValue;
    document.getElementById("divProcessing").innerHTML = "";
}




function JumpPageLawDocumentItemForSearchAll(TabModuleId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPageIndex, JumpJavaScript) {
    document.getElementById("divProcessing").innerHTML = Portal.CMS.SearchAllLawDocumentItems.GetProcessingText().value;
    setTimeout("RealJumpPageLawDocumentItemForSearchAll('" + TabModuleId + "','" + CurrentPageIndex + "')", 10);
}

function RealJumpPageLawDocumentItemForSearchAll(TabModuleId, CurrentPageIndex) {
    LawDocumentIndex = document.getElementById("drpSelectLawDocument").selectedIndex;
    LawDocumentId = document.getElementById("drpSelectLawDocument").options[LawDocumentIndex].value;
    Code = document.getElementById("txtCode").value;
    Subject = document.getElementById("txtSubject").value;
    LawDocumentOfficeId = document.getElementById("drpSelectLawDocumentOffice").options[document.getElementById("drpSelectLawDocumentOffice").selectedIndex].value;
    LawDocumentTypeId = document.getElementById("drpSelectLawDocumentType").options[document.getElementById("drpSelectLawDocumentType").selectedIndex].value;
    LawDocumentSignerId = document.getElementById("drpSelectLawDocumentSigner").options[document.getElementById("drpSelectLawDocumentSigner").selectedIndex].value;
    Keyword = document.getElementById("txtKeyword").value;

    rValue = Portal.CMS.SearchAllLawDocumentItems.Search(LawDocumentId, Code, Subject, LawDocumentOfficeId, LawDocumentTypeId, LawDocumentSignerId, Keyword, CurrentPageIndex).value;
    if (rValue.indexOf("ERROR") != -1) {
        alert(rValue);
        return;
    }
    document.getElementById("divFormResult").innerHTML = rValue;
    document.getElementById("divProcessing").innerHTML = "";
}


function JumpPageLawDocumentItem(LawDocumentId, MaxItems, ItemsPerRow, NoOfVisiblePage, CurrentPageIndex, JumpJavaScript) {
    document.getElementById("divProcessing").innerHTML = Portal.CMS.LawDocumentItems.GetProcessingText().value;
    setTimeout("RealJumpPageLawDocumentItem('" + LawDocumentId + "','" + CurrentPageIndex + "')", 10);
}

function RealJumpPageLawDocumentItem(LawDocumentId, CurrentPageIndex) {
    Code = document.getElementById("txtCode").value;
    Subject = document.getElementById("txtSubject").value;
    LawDocumentOfficeId = document.getElementById("drpSelectLawDocumentOffice").options[document.getElementById("drpSelectLawDocumentOffice").selectedIndex].value;
    LawDocumentTypeId = document.getElementById("drpSelectLawDocumentType").options[document.getElementById("drpSelectLawDocumentType").selectedIndex].value;
    LawDocumentSignerId = document.getElementById("drpSelectLawDocumentSigner").options[document.getElementById("drpSelectLawDocumentSigner").selectedIndex].value;
    Keyword = document.getElementById("txtKeyword").value;

    rValue = Portal.CMS.LawDocumentItems.Search(LawDocumentId, Code, Subject, LawDocumentOfficeId, LawDocumentTypeId, LawDocumentSignerId, Keyword, CurrentPageIndex).value;
    if (rValue.indexOf("ERROR") != -1) {
        alert(rValue);
        return;
    }
    document.getElementById("divFormResult").innerHTML = rValue;
    document.getElementById("divProcessing").innerHTML = "";
}

function SyncLawDocumentItem(LawDocumentItemId) {
    if (confirm(Portal.CMS.LawDocumentItems.GetConfirmSyncAllMsg().value) == false) {
        return;
    }
    document.getElementById("divProcessing").innerHTML = Portal.CMS.LawDocumentItems.GetProcessingText().value;
    setTimeout("RealSyncLawDocumentItem('"+LawDocumentItemId+"')", 10);
}

function RealSyncLawDocumentItem(LawDocumentItemId) {

    rValue = Portal.CMS.LawDocumentItems.SyncLawDocumentItem(LawDocumentItemId).value;
    alert(rValue);
    document.getElementById("divProcessing").innerHTML = "";
}


function ClientSyncLawDocument(LawDocumentId) {
    if (confirm(Portal.CMS.LawDocument.GetConfirmSyncAllMsg().value) == false) {
        return;
    }
    document.getElementById("divProcessing").innerHTML = Portal.CMS.LawDocument.GetProcessingText().value;
    setTimeout("RealClientSyncLawDocument('" + LawDocumentId + "')", 10);
}

function RealClientSyncLawDocument(LawDocumentId) {

    rValue = Portal.CMS.LawDocument.SyncLawDocument(LawDocumentId).value;
    alert(rValue);
    document.getElementById("divProcessing").innerHTML = "";
}